/*
 * ForeverInstruction.java
 * 
 * last update: 16.01.2010 by Stefan Saru
 * 
 * author:	Power(power@kermit.cs.pub.ro)
 * 
 * Obs:
 */

package engine;

class ForeverInstruction extends DefaultInstruction{

	ForeverInstruction(NameSpace ns, int db, InstructionDescription desc,
			DefaultInstruction body,DefaultInstruction next)
			{
		super(ns, db, desc);
		if (body != null) {
			body.append(body); //make it loop forever
			add(body);
		}
		else add(this);
			}

	public void execute()
	throws InterpretTimeException, SimulationStoppedException
	{
		waitToRun();
		xConsole.trace(toString());
	}

}
